<?php

/**
 * Boek form base class.
 *
 * @method Boek getObject() Returns the current form's model object
 *
 * @package    jobeet
 * @subpackage form
 * @author     Your name here
 */
abstract class BaseBoekForm extends BaseFormPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'         => new sfWidgetFormInputHidden(),
      'ISBN'       => new sfWidgetFormInputText(),
      'titel'      => new sfWidgetFormInputText(),
      'auteur'     => new sfWidgetFormInputText(),
      'aantal'     => new sfWidgetFormInputText(),
      'afbeelding' => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'id'         => new sfValidatorChoice(array('choices' => array($this->getObject()->getId()), 'empty_value' => $this->getObject()->getId(), 'required' => false)),
      'ISBN'       => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647, 'required' => false)),
      'titel'      => new sfValidatorString(array('max_length' => 30, 'required' => false)),
      'auteur'     => new sfValidatorString(array('max_length' => 30, 'required' => false)),
      'aantal'     => new sfValidatorInteger(array('min' => -2147483648, 'max' => 2147483647, 'required' => false)),
      'afbeelding' => new sfValidatorString(array('max_length' => 255, 'required' => false)),
    ));

    $this->validatorSchema->setPostValidator(
      new sfValidatorPropelUnique(array('model' => 'Boek', 'column' => array('ISBN')))
    );

    $this->widgetSchema->setNameFormat('boek[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Boek';
  }


}
